package com.ruoyi.project.system.controller;

import java.util.HashMap;
import java.util.List;
import java.util.Map;

import cn.binarywang.wx.miniapp.api.WxMaService;
import cn.binarywang.wx.miniapp.bean.WxMaJscode2SessionResult;
import cn.hutool.core.util.IdUtil;
import com.ruoyi.common.utils.ImageUtils;
import com.ruoyi.common.utils.SecurityUtils;
import com.ruoyi.framework.security.LoginUser;
import com.ruoyi.framework.security.service.TokenService;
import com.ruoyi.project.system.domain.vo.UserInfo;
import com.ruoyi.project.system.domain.vo.WxLoginInfo;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import jdk.nashorn.internal.parser.Token;
import org.springframework.security.access.prepost.PreAuthorize;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.PutMapping;
import org.springframework.web.bind.annotation.DeleteMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import com.ruoyi.framework.aspectj.lang.annotation.Log;
import com.ruoyi.framework.aspectj.lang.enums.BusinessType;
import com.ruoyi.project.system.domain.SysMobileUser;
import com.ruoyi.project.system.service.ISysMobileUserService;
import com.ruoyi.framework.web.controller.BaseController;
import com.ruoyi.framework.web.domain.AjaxResult;
import com.ruoyi.framework.web.page.TableDataInfo;

/**
 * 【请填写功能名称】Controller
 *
 * @author theme
 * @date 2020-05-27
 */
@Api(description = "【请填写功能名称】Controller" )
@RestController
@RequestMapping("/system/mobileUser" )
public class SysMobileUserController extends BaseController {
    @Autowired
    private ISysMobileUserService sysMobileUserService;

/**
 * 查询【请填写功能名称】列表
 */
@ApiOperation("查询【请填写功能名称】列表" )
@PreAuthorize("@ss.hasPermi('system:user:list')" )
@GetMapping("/list" )
        public TableDataInfo list(SysMobileUser sysMobileUser) {
        startPage();
        List<SysMobileUser> list = sysMobileUserService.selectSysMobileUserList(sysMobileUser);
        return getDataTable(list);
    }
    
    /**
     * 获取【请填写功能名称】详细信息
     */
    @ApiOperation("获取【请填写功能名称】详细信息" )
    @PreAuthorize("@ss.hasPermi('system:user:query')" )
    @GetMapping(value = "/{mobileUserId}" )
    public AjaxResult getInfo(@PathVariable("mobileUserId" ) Long mobileUserId) {
        return AjaxResult.success(sysMobileUserService.selectSysMobileUserById(mobileUserId));
    }

    /**
     * 新增【请填写功能名称】
     */
    @ApiOperation("新增【请填写功能名称】" )
    @PreAuthorize("@ss.hasPermi('system:user:add')" )
    @Log(title = "【请填写功能名称】" , businessType = BusinessType.INSERT)
    @PostMapping
    public AjaxResult add(@RequestBody SysMobileUser sysMobileUser) {
        return toAjax(sysMobileUserService.insertSysMobileUser(sysMobileUser));
    }

    /**
     * 修改【请填写功能名称】
     */
    @ApiOperation("修改【请填写功能名称】" )
    @PreAuthorize("@ss.hasPermi('system:user:edit')" )
    @Log(title = "【请填写功能名称】" , businessType = BusinessType.UPDATE)
    @PutMapping
    public AjaxResult edit(@RequestBody SysMobileUser sysMobileUser) {
        return toAjax(sysMobileUserService.updateSysMobileUser(sysMobileUser));
    }

    /**
     * 删除【请填写功能名称】
     */
    @ApiOperation("删除【请填写功能名称】" )
    @PreAuthorize("@ss.hasPermi('system:user:remove')" )
    @Log(title = "【请填写功能名称】" , businessType = BusinessType.DELETE)
    @DeleteMapping("/{mobileUserId}" )
    public AjaxResult remove(@PathVariable Long mobileUserId) {
        return toAjax(sysMobileUserService.deleteSysMobileUserById(mobileUserId));
    }

    /**
     * 获取今日新增
     */
    @ApiOperation("查询【请填写功能名称】列表" )
    @PreAuthorize("@ss.hasPermi('system:user:queryToday')" )
    @GetMapping("/queryToday" )
    public AjaxResult queryToday() {
        return AjaxResult.success(sysMobileUserService.queryToday());
    }

    /**
     *  报名总数
     */
    @ApiOperation("报名总数" )
    @PreAuthorize("@ss.hasPermi('system:user:queryAll')" )
    @GetMapping("/queryAll" )
    public AjaxResult qieryAll() {
        return AjaxResult.success(sysMobileUserService.queryAll());
    }

}
